package com.pojo.req.user;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.utility.constant.MessageConstant;
import com.utility.constant.RegularConstant;
import com.utility.gruops.InsertAndUpdateGroups;
import com.utility.gruops.InsertGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author Huawei
 * @date 2023-10-25 14:08
 */
@Data
public class UserInsertReq {

    /**
     * 用户名
     */
    @NotNull(message = "用户名"+ MessageConstant.NULL_MESSAGE)
    @Length(min = 1,
            max = 128,
            message =  "用户名"+ MessageConstant.LENGTH_MESSAGE_128)
    private String userName;



    /**
     * 昵称
     */
    @Length(min = 0,
            max = 128,
            message =  "昵称"+ MessageConstant.LENGTH_MESSAGE_128)
    private String nickName;

    /**
     * 性别 0 男  1女
     */
    @Max(value = 1,
            message = "性别"+MessageConstant.FORMAT_MESSAGE)
    @Min(value = 0,
            message = "性别"+MessageConstant.FORMAT_MESSAGE)
    private Short gender;


    /**
     * 手机号
     */
    @NotNull(message = "手机号"+ MessageConstant.NULL_MESSAGE)
    @Length(min = 11,
            max = 11,
            message = "手机号"+MessageConstant.LENGTH_MESSAGE_11)
    @Pattern(regexp = RegularConstant.phone,
            message = MessageConstant.FORMAT_MESSAGE+"手机号")
    private String phone;


    /**
     * 邮箱（二期新增）
     */
    @Pattern(regexp = RegularConstant.mail,
            message = MessageConstant.FORMAT_MESSAGE+"邮箱")
    private String mail;


    /**
     *  角色id
     */
    @NotNull(message = "角色"+ MessageConstant.NULL_MESSAGE)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long roleId;
}
